import http from '.'
/**
 * 通信卡
 */
export function querySim(params) {
  return http.get(
    'api/v1/communication/sim/query?' + Form(params).queryString()
  )
}

/**
 * 删除通信卡
 */
export function deleteSim(rowId) {
  return http.post('api/v1/communication/sim/deleteSimAndSimCh?rowId=' + rowId)
}
/**
 * 新增、修改通信卡
 */
export function addOrEditSim(params) {
  return http.post(
    `api/v1/communication/sim/${
      params.rowId ? 'updateSmSimAndSmSimCh' : 'insertSmSimAndSmSimCh'
    }?` + Form(params)
  )
}
/**
 * 详情
 */
export function detailSim(rowId) {
  return http.get('api/v1/communication/sim/detail?rowId=' + rowId)
}
/**
 * 绑定
 */
export function bindingSim(rowId, phone) {
  return http.post(
    'api/v1/communication/sim/bindingSim?phone=' + phone + '&rowId=' + rowId
  )
}
/**
 * 解绑
 */
export function untieSim(rowId, phone) {
  return http.post(
    'api/v1/communication/sim/untieSim?phone=' + phone + '&rowId=' + rowId
  )
}
/**
 * 通信卡日志查询
 */
export function querySimChLog(params) {
  return http.get(
    'api/v1/communication/simChLog/query?' + Form(params).queryString()
  )
}
/**
 * 通信卡日志查询
 */
export function deleteSimChLog(rowId) {
  return http.post('api/v1/communication/simChLog/delete?rowId=' + rowId)
}
/**
 * 通信卡查询
 */
export function selectPhone() {
  return http.get('api/v1/communication/mdSimStock/selectPhone')
}
/**
 * 通信卡查询详情
 */
export function selectDetail(simId) {
  return http.get('api/v1/communication/mdSimStock/detail?rowId=' + simId)
}
/**
 * 查询电信卡库存列表
 * @param {*} params
 */
export function querySimStock(params) {
  return http.get('api/v1/communication/mdSimStock/query?' + Form(params))
}
/**
 * 获取电信卡批次
 */
export function querySimStockBatch() {
  return http.get('api/v1/communication/mdSimStock/querySimStockBatch')
}
/**
 * 新增电信卡批次
 * @param {*} params
 */
export function addSimStockBatch(params) {
  return http.post(
    `api/v1/communication/mdSimStock/${
      params.rowId ? 'edit' : 'addMdSimStock'
    }`,
    Form(params)
  )
}
/**
 * 删除电信卡批次
 * @param {*} rowId
 */
export function deleteSimStockBatch(rowId) {
  return http.post('api/v1/communication/mdSimStock/delete?rowId=' + rowId)
}
/**
 * 导入excle
 */
export function uploadFile(excle) {
  return http.post('api/v1/communication/mdSimStock/insertBatch', excle)
}
/**
 * sim卡基本信息
 * @param {*} params
 */
export function SimInfo(params) {
  return http.get(
    'api/v1/communication/sim/findSimDetail?' + Form(params).queryString()
  )
}
/**
 * sim卡流量历史
 * @param {*} params
 */
export function SimHistory(params) {
  return http.get(
    'api/v1/communication/sim/findSimHistoryFlow?' + Form(params).queryString()
  )
}
